package km.TestDeviceInfo;

import java.sql.*;

import android.app.*;
import android.content.*;
import android.content.pm.*;
import android.graphics.*;
import android.net.*;
import android.os.Bundle;
import android.provider.*;
import android.telephony.*;
import android.util.*;
import android.view.*;
import android.view.View.*;
import android.widget.*;

public class TestDeviceInfo extends Activity {
    private TextView tv;

	/** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        
        tv =(TextView)findViewById(R.id.TextView01);
        getInfo();
    }
    private void getInfo(){
        //단말정보가져오기
        TelephonyManager tm = (TelephonyManager) this.getSystemService(Context.TELEPHONY_SERVICE);
		ConnectivityManager manager = (ConnectivityManager)this.getSystemService(Context.CONNECTIVITY_SERVICE);
		ActivityManager am = (ActivityManager)getSystemService(Context.ACTIVITY_SERVICE);
		boolean isMobile = manager.getNetworkInfo(ConnectivityManager.TYPE_MOBILE).isConnectedOrConnecting();
		boolean isWifi = manager.getNetworkInfo(ConnectivityManager.TYPE_WIFI).isConnectedOrConnecting();
		WindowManager wm =this.getWindowManager();		
        Display dis = getWindowManager().getDefaultDisplay();
        tv.append("3G : "+isMobile+"\n");
        tv.append("Wifi : "+isWifi+"\n");
        tv.append("SimOperatorName : "+tm.getSimOperatorName()+"\n");
        tv.append("getLine1Number : "+tm.getLine1Number()+"\n");
        tv.append("getDeviceSoftwareVersion : "+tm.getDeviceSoftwareVersion()+"\n");
        tv.append("getDeviceId : "+ tm.getDeviceId()+"\n");
        tv.append("api : "+android.os.Build.VERSION.SDK+"\n");
        tv.append("sdk : "+android.os.Build.VERSION.RELEASE+"\n");
	    tv.append("brand : "+android.os.Build.BRAND+"\n");
	    tv.append("device : "+android.os.Build.DEVICE+"\n");
	    tv.append("display : "+android.os.Build.DISPLAY+"\n");
	    tv.append("ID : "+android.os.Build.ID+"\n");
	    tv.append("MODEL : "+android.os.Build.MODEL+"\n");
	    tv.append("PRODUCT : "+android.os.Build.PRODUCT+"\n");
	    tv.append("HARDWARE : "+android.os.Build.HARDWARE+"\n");
	    tv.append("USER : "+android.os.Build.USER+"\n");
	    tv.append("BRAND : "+android.os.Build.BRAND+"\n");
	    DisplayMetrics displayMetrics = new DisplayMetrics();
	    getWindowManager().getDefaultDisplay().getMetrics(displayMetrics);
	    int deviceWidth = displayMetrics.widthPixels;
	    int deviceHeight =displayMetrics.heightPixels;
	    tv.append("getWidth : "+dis.getWidth()+"\n");
	    tv.append("getHeight : "+dis.getHeight()+"\n");
	    tv.append("deviceWidth : "+deviceWidth+"\n");
	    tv.append("deviceHeight : "+deviceHeight+"\n");
	    tv.append("density : "+this.getResources().getDisplayMetrics().density+"\n");
	    tv.append("dpi : "+this.getResources().getDisplayMetrics().densityDpi+"\n");
	    tv.append("widthPixels : "+this.getResources().getDisplayMetrics().widthPixels+"\n");
	    tv.append("heightPixels : "+this.getResources().getDisplayMetrics().heightPixels+"\n");
	    tv.append("scaledDensity : "+this.getResources().getDisplayMetrics().scaledDensity+"\n");
        long time =android.os.Build.TIME;
        Date date = new Date(time);
        tv.append("buildTime : "+date+"\n"); 
        try {
           PackageInfo i = getPackageManager().getPackageInfo(getPackageName(), 0);
           tv.append("versionName : "+i.versionName); 
        } catch(Exception e) { }
        
	    //Log..
//        Log.e("","3G : "+isMobile);
//        Log.e("","Wifi : "+isWifi);
//        Log.e("","SimOperatorName : "+tm.getSimOperatorName());
//        Log.e("","getLine1Number : "+tm.getLine1Number());
//        Log.e("","getDeviceSoftwareVersion : "+tm.getDeviceSoftwareVersion());
//        Log.e("","getDeviceId : "+ tm.getDeviceId());
//        Log.e("","api : "+android.os.Build.VERSION.SDK);
//        Log.e("","sdk : "+android.os.Build.VERSION.RELEASE);
//	    Log.e("","brand : "+android.os.Build.BRAND);
//	    Log.e("","device : "+android.os.Build.DEVICE);
//	    Log.e("","display : "+android.os.Build.DISPLAY);
//	    Log.e("","ID : "+android.os.Build.ID);
//	    Log.e("","MODEL : "+android.os.Build.MODEL);
//	    Log.e("","getWidth : "+dis.getWidth());
    }
}